<template>
	<view class="content">
		<view class="uni-container statistics_bg">
			<view class="uni-flex uni-row" style="display: flex;flex-direction: row;justify-content: space-between;">
				<view class="text">原辅材料及能源消耗</view>
			</view>

			<uni-table ref="table" border stripe>
				<uni-tr>
					<uni-th align="center">时间维度</uni-th>
					<uni-th align="center">材料类别</uni-th>
					<uni-th align="center">领料</uni-th>
					<uni-th align="center">消耗量</uni-th>
					<uni-th align="center">铸件生产数量(件)</uni-th>
					<uni-th align="center">铸件生产重量(KG)</uni-th>
					<uni-th align="center">铸件公斤消耗量</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in tableData" :key="index">
					<uni-td align="center">{{ item.period }}</uni-td>
					<uni-td align="center">
						<view class="name">{{ item.materialtype }}</view>
					</uni-td>
					<uni-td align="center">{{ item.receive }}</uni-td>
					<uni-td align="center">{{ item.consume }}</uni-td>
					<uni-td align="center">{{ item.cast_pcs }}</uni-td>
					<uni-td align="center">{{ item.cast_kg }}</uni-td>
						<uni-td align="center">{{ item.cast_consume_kg }}</uni-td>
				</uni-tr>
			</uni-table>

		</view>
		


	</view>
</template>

<script>
	import {
		GetOperationsOverview
	} from '../../common/opsoverview_api.js'


	export default {
		data() {
			return {
				tableData: [],
				opts: {

				}
				
			}
		},
		onReady() {

			uni.setNavigationBarTitle({
				title: "原辅材料及能源消耗"
			})
			this.loadData();
		},



		methods: {
			loadData() {
                var data = {
					dimension_type:"原辅材料及能源消耗"
				};
				GetOperationsOverview(data).then(res => {
					var array = [];
					for (var i = 0; i < res.length; i++) {
						var item = res[i];
						array.push(item);
					}
					this.tableData = array;
				});
				
			},


		},
	}
</script>

<style>
	@import url("aluminumtotal.css");
</style>